package co.yixiang.modules.shop.rest;

import co.yixiang.aop.log.Log;
import co.yixiang.modules.shop.service.YxStoreBonusDetailService;
import co.yixiang.modules.shop.service.YxStoreBonusService;
import co.yixiang.modules.shop.service.dto.YxStoreBonusQueryCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

/**
* @author frq
* @date 2020-07-22
*/
@Api(tags = "认购者分红管理")
@RestController
@RequestMapping("/api/yxStoreBonus")
public class YxStoreBonusController {
    @Autowired
    private YxStoreBonusService yxStoreBonusService;

    @Autowired
    private YxStoreBonusDetailService yxStoreBonusDetailService;



    @GetMapping
    @Log("查询认购者分红")
    @ApiOperation("查询认购者分红")
    public ResponseEntity<Object> getYxStoreBonuss(YxStoreBonusQueryCriteria criteria, Pageable pageable){
        return new ResponseEntity<>(yxStoreBonusService.queryAll(criteria,pageable),HttpStatus.OK);
    }
    @Log("查询认购者分红明细")
    @ApiOperation("查询认购者分红明细")
    @GetMapping("/findBonusDetail/{bonusId}")
    public ResponseEntity<Object> findBonusDetail(@PathVariable Integer bonusId){
        return new ResponseEntity<>(yxStoreBonusDetailService.findByBonusId(bonusId),HttpStatus.OK);
    }
}